module.exports = {
  /**
   * 更新订单的配置
   * @url update/OrderConfig 前端调用的url参数地址
   */
  main: async (event) => {
    let {
      data = {}, userInfo, util, originalParam
    } = event;
    let {
      uniID,
      pubFun,
      vk,
      db,
      _
    } = util;
    let res = {
      code: 0,
      msg: 'ok'
    };
    let dbName = 'vk-collection'
    // 业务逻辑开始----------------------------------------------------------- 
    if (!data.ids && data.ids.length == 0) {
      return {
        code: 412,
        msg: 'id不能为空'
      }
    }
    let count = 0
    let arr = data.ids
    for (let i = 0; i < arr.length; i++) {
      let id = arr[i]
      await vk.baseDao.del({
        dbName,
        whereJson: {
          _id: id
        }
      }, event.util);
      count++
    }
    if (count == arr.length) {
      return res
    } else {
      return {
        code: 412,
        msg: '更新报错，请稍后重试'
      }
    }
  }

}
